From 8e4addea279da7430d80514828f49013979117e6 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Thu, 6 Dec 2012 14:19:15 +0100 Subject: [PATCH] memop: adjust error checking in populate_physmap() Checking that multi-page allocations are permitted is unnecessary for PoD population operations. Instead, the (loop invariant) check added for addressing XSA-31 can be moved here. Signed-off-by: Jan Beulich Acked-by: Keir Fraser --- xen/common/memory.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/common/memory.c b/xen/common/memory.c index a076f81afe..a88348f802 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -99,7 +99,8 @@ static void populate_physmap(struct memop_args *a) a->nr_extents-1) ) return; - if ( !multipage_allocation_permitted(current->domain, a->extent_order) ) + if ( a->memflags & MEMF_populate_on_demand ? a->extent_order > MAX_ORDER : + !multipage_allocation_permitted(current->domain, a->extent_order) ) return; for ( i = a->nr_done; i < a->nr_extents; i++ ) @@ -115,8 +116,7 @@ static void populate_physmap(struct memop_args *a) if ( a->memflags & MEMF_populate_on_demand ) { - if ( a->extent_order > MAX_ORDER || - guest_physmap_mark_populate_on_demand(d, gpfn, + if ( guest_physmap_mark_populate_on_demand(d, gpfn, a->extent_order) < 0 ) goto out; } -- 2.30.2